﻿using System.Data.Linq;
using Castle.Facilities.TypedFactory;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Genrsis.WorkitemTracking.ReadLayer;

namespace Genrsis.WorkitemTracking.Web.Infrastructure.IoC
{
    public class ReadLayerInstaller : IWindsorInstaller
    {
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(
                Component.For<DataContext>()
                    .ImplementedBy<WorkitemTrackingDataContext>()
                    .LifeStyle.PerWebRequest,
                Component.For<IQueryContext>()
                    .ImplementedBy<DbmlQueryContext>()
                    .LifeStyle.PerWebRequest,
                Component.For<IQueryContextFactory>()
                    .AsFactory()
                );
        }
    }
}